<?php
/**
 * Created by PhpStorm.
 * User: moquan
 * Date: 2018/7/2
 * Time: 17:34
 */

namespace app\admin\controller;


use think\Cache;
use think\Request;

class System extends Base {
    function index(){
        return $this->fetch();
    }

    /**
     * 清空系统缓存
     */
    public function cleanCache(){
        //$script = "<script>alert('缓存清除成功');alert('".$url."');window.location.reload();</script>";

//        $quick = I('quick',0);
        /*if($quick == 1){
            $script = "<script>parent.layer.msg('缓存清除成功', {time:3000,icon: 1});window.parent.location.reload();</script>";
        }else{
            $script = "<script>parent.layer.msg('缓存清除成功', {time:3000,icon: 1});window.location='/index.php?m=Admin&c=Index&a=welcome';</script>";
        }*/
        $delTemp = del_file(RUNTIME_PATH.'/temp',true);
        $clear = Cache::clear();
        if( $delTemp && $clear ){
//            echo json_encode(['status'=>1]);
            return true;
        }else{
//            echo json_encode(['status'=>-1]);
            return false;
        }
    }
}